package stack.era.presentation.char_side_screen;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;

public class ERAPlusButton extends JButton implements MouseListener {

	private static final long serialVersionUID = 288929359634777582L;

	private static final Dimension BUTTON_SIZE = new Dimension(50, 50);
	
	public static final String ACTIVE_STATUS = " +1 Point ";
	public static final String NO_POINTS_STATUS = " No Points ";
	public static final String MAXED_STATUS = " Maxed ";

	/**
	 * Setup the look and feel of a plus button object.
	 * 
	 */
	public ERAPlusButton() {
		super(" +1 Point ");

		this.setSize(BUTTON_SIZE);
		this.setBackground(Color.WHITE);
		this.setForeground(Color.BLACK);
		this.setOpaque(false);
		this.setBorder(null);

		this.addMouseListener(this);
	}

	@Override
	public void paint(Graphics g) {
		Graphics2D g2 = (Graphics2D) g.create();
		g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
				0.5f));
		g2.setColor(this.getBackground());
		g2.fillRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 10, 10);
		g2.setColor(Color.BLACK);
		g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 10, 10);
		g2.dispose();
		super.paint(g);
	}

	public void setStatus(String status) {
		this.setText(status);
	}
	
	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		if (this.isEnabled()) {
			this.setBackground(Color.BLUE);
			this.setForeground(Color.WHITE);
			this.repaint();
			this.requestFocus();
		}
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		this.setBackground(Color.WHITE);
		this.setForeground(Color.BLACK);
		this.repaint();
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

}
